<?php
namespace app\api\validate;

use think\Validate;

class PointValidate extends Validate{
    protected $rule =   [
        'id'            => 'require|number',
        'user_id'       => 'require|number',
        'goods_id'      => 'require|number',
        'shop_id'       => 'require|number',
        'phone'         => 'require|length:11',
        'address_id'    => 'require|number',
        'curr'          => 'require|number',
        'limit'         => 'require|number',
        'number'        => 'require|number',
        'remarks'       => 'length:1,255',
    ];
    
    protected $message  =   [
        'id.require'            => 'ID必须',
        'id.number'             => 'ID必须是数字',
        'user_id.require'       => '用户ID必须',
        'user_id.number'        => '用户ID数据类型错误',
        'shop_id.require'       => '店铺ID必须',
        'shop_id.number'        => '店铺ID数据类型错误',
        'goods_id.require'      => '商品ID必须',
        'goods_id.number'       => '商品ID数据类型错误',
        'phone.require'         => '取货手机号不能为空',
        'phone.number'          => '请输入11有效手机号',
        'curr.require'          => '页数必须',
        'curr.number'           => '页数数据类型错误',
        'limit.require'         => '条数必须',
        'limit.number'          => '条数数据类型错误',
        'number.require'        => '数量必须',
        'number.number'         => '数量数据类型错误',
        'remarks.length'        => '备注长度错误(1-255个字符)',
    ];
    
    protected $scene = [
        'add'          => ['user_id', 'goods_id', 'phone', 'remarks'],
        'exchangeList' => ['user_id', 'curr', 'limit'],
    ];
}